{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Load Data**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_csv('C:/Users/irene/Downloads/T1.csv')\n",
    "new_data = df.dropna(axis = 0, how ='any')\n",
    "new_data.describe()\n",
    "cap=max(new_data['LV ActivePower (kW)'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Parameter Settings**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "i=[1] #enter month value, i.e January = 1\n",
    "look_back=6\n",
    "data_partition=0.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "from myfunctions import svr_model,ann_model,rf_model,lstm_model,emd_lstm,eemd_lstm,ceemdan_lstm,proposed_method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "CUDA_VISIBLE_DEVICES=\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    5.047757\n",
      "RMSE 533.8181880316546\n",
      "MAE 182.6648444555125\n"
     ]
    }
   ],
   "source": [
    "svr_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 3.182240336540624\n",
      "RMSE 281.3569178747461\n",
      "MAE 115.15677833369031\n"
     ]
    }
   ],
   "source": [
    "ann_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    4.309892\n",
      "RMSE 395.4005336394779\n",
      "MAE 155.96346608880432\n"
     ]
    }
   ],
   "source": [
    "rf_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 2.613480435663023\n",
      "RMSE 269.37537340583975\n",
      "MAE 94.5748766217492\n"
     ]
    }
   ],
   "source": [
    "lstm_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    5.635335\n",
      "RMSE 370.97875979714047\n",
      "MAE 203.92771063699968\n"
     ]
    }
   ],
   "source": [
    "emd_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.761098\n",
      "RMSE 145.18313542113597\n",
      "MAE 63.729434906960954\n"
     ]
    }
   ],
   "source": [
    "eemd_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.653885\n",
      "RMSE 167.75414973758345\n",
      "MAE 59.84967740253258\n"
     ]
    }
   ],
   "source": [
    "ceemdan_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.406544\n",
      "RMSE 121.68207298322395\n",
      "MAE 50.89907430764963\n"
     ]
    }
   ],
   "source": [
    "proposed_method(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
